Repository navigation
Conversation
Contributor
Tests PassedCommit: 7088f9f |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Follow-up to #102401. Adds a way to choose between prerendering,
use(browser()), andnext/dynamicwhen you land on either guide.Lazy Loading guide:
ssr: falseis for: lazy load a component and keep its module out of the server render.loadingplaceholder does on a click, and how to show the component as soon as its code loads by updating state in a transition.<Activity>, or preloading on hover and focus through a shared loader.Single-Page Applications guide:
use(browser())andnext/dynamicwithssr: false.Why?
The two APIs were described, but the decision between them was spread across paragraphs, and nothing covered components that load after an interaction. That case has behavior worth knowing: with a
loadingplaceholder the component appears with React's next batch of suspended content, even when its code is already loaded.Verification
Measured in a repro app on a production build (Next.js 16.4.6,
cacheComponents: true, Turbopack, headless Chrome). Time from click to content, with a 150ms delay on scripts requested after the click:next/dynamicwithloadingnext/dynamicwithoutloading, in a transitionnext/dynamicwithoutloading, no transition, inside a page<Suspense><Activity>aroundnext/dynamicReact.lazy, click 300ms laterAlso checked:
windowat import failsnext buildbehinduse(browser())and builds withnext/dynamicandssr: false.